package com.chenl.provider.DEMOS.WebMvcConfigurer配置;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/mtInter")
public class MyinterceptorController {

    @GetMapping("/test")
    public String test(){
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        String cookiee = request.getHeader("cookiee");
        System.out.println(cookiee);
        return cookiee;
    }

    @GetMapping("/test2")
    public String test2(){
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        String cookiee = request.getHeader("cookiee");
        System.out.println(cookiee);
        return cookiee;
    }
}
